home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ANSICRT2.ZIP / ANSPEED.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-21  |  3KB  |  84 lines

  1. USES AnsiCrt;
  2. { I wrote this program to put the AnsiCrt Unit through its paces in relation
  3.   to the TextColor, TextBackground, HighVideo, LowVideo procedures.
  4.   It can be used to compare the speed of Ansi-based 'CRT replacement Units'
  5.   but comparison between speed of different ANSI.SYS replacements might also
  6.   be interesting, though not definitive.
  7.   Strings of length 10 are written to the screen for each foreground colour,
  8.   then the background colour is incremented and the cycle  of foreground
  9.   colours starts again.
  10.   For each foreground colour:
  11.    1. The Text is switched into HighVideo or LowVideo after it has been
  12.       displayed 'normally'. e.g. Red would become LightRed, but if the colour
  13.       was initially LightRed it would be switched to Red.
  14.       A string of length 10 is then displayed in that foreground colour.
  15.    2. Blinking is then added to the foreground colour and the 2 length 10
  16.       strings written as above (i.e. being switched into low or high depending).
  17.  
  18.   Hence for each fore/background colour combination the foreground goes
  19.   through 2 intensity states by 2 blink states
  20.   i.e 4 x 10 characters = half line.
  21.   There are 16 foregound colours to test so this takes 8 lines for each
  22.   background colour.
  23.   There are 8 background colours, therefore one cycle of the test takes
  24.   64 lines. The test is cycled through 25 times to give better timing accuracy.
  25.   Therefore 1600 lines are written which is 64 screens.
  26.  
  27. Results:
  28. 1) Using the ANSI.SYS supplied with DOS5 the test took 128.63 secs which is
  29. about 2 secs per screen. Not bad for _intensive_ Ansi.
  30. 2) AnsCrt written in 1988 by Rick Housh took 200.56 secs. In any case, it
  31. has a fault with HighVideo i.e. HighVideo after blinking text switches off
  32. the blink and then doesn't actually produce the bold text required.
  33.   }
  34.  
  35. VAR fgcol, bgcol, forecol: BYTE;
  36.     times, testcycles: INTEGER;
  37.     StartTime,StopTime: LONGINT;
  38.     TimerTicks: LONGINT ABSOLUTE $40:$6C;
  39.     Duration: REAL;
  40.  
  41. BEGIN
  42.   Writeln('Start');
  43.   StartTime := TimerTicks;
  44.   FOR testcycles := 1 to 25 do
  45.   begin
  46.     FOR bgcol := Black TO LightGray DO
  47.     BEGIN
  48.       TextBackground(bgcol);
  49.       FOR fgcol := Black TO LightGray DO
  50.       BEGIN
  51.         forecol := fgcol; { the extra var forecol is to protect the fg count}
  52.         FOR times := 1 TO 2 DO
  53.         BEGIN
  54.           TextColor(forecol);
  55.           Write('NormColour');
  56.           HighVideo;
  57.           Write(' HighVideo');
  58.           IF times = 1 THEN forecol := forecol+ Blink
  59.         END
  60.       END;
  61.       FOR fgcol := DarkGray TO White DO
  62.       BEGIN
  63.         forecol := fgcol;
  64.         FOR times := 1 TO 2 DO
  65.         BEGIN
  66.           TextColor(forecol);
  67.           Write('NormColour');
  68.           LowVideo;
  69.           Write(' LowVideo ');
  70.           IF times = 1 THEN forecol := forecol + Blink
  71.         END
  72.       END
  73.     END
  74.   END;
  75.   StopTime := TimerTicks;
  76.   NormVideo;
  77.   Writeln;
  78.   Duration := (StopTime-StartTime);
  79.   Duration := Duration/18.2;
  80.   Writeln(#7,'The test took ',duration,' seconds.')
  81. END.
  82.  
  83.  
  84.